package chapter01.ocp.incorrect;

import chapter01.ocp.ICalculationArea;

public class CalculationArea2 implements ICalculationArea {
    private final static  double PI = 3.1415926;
    @Override
    public double rectangle(double x, double y) {
        return x*y;
    }

    @Override
    public double triangle(double x, double y, double z) {
        double p=(x+y+z)/2;
        return Math.sqrt(p*(p-x)*(p-y)*(p-z));
    }

    @Override
    public double cirular(double r) {
        return PI*r*r;
    }
}
